package com.zhilingshenghuo.app.zhly.view.adapter

import android.graphics.Color
import com.zhilingshenghuo.app.zhly.R
import com.zhilingshenghuo.app.zhly.entity.SendRecordResponse
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder


class SendRecordAdapter :
    BaseQuickAdapter<SendRecordResponse.ListBean.DataBean, BaseViewHolder>(R.layout.item_send_record) {
    override fun convert(holder: BaseViewHolder, item: SendRecordResponse.ListBean.DataBean) {
        holder.setText(R.id.tvTitle, item.room.title)
        holder.setText(R.id.tvUserName, item.room.title)
        holder.setText(R.id.tvDate, item.created_at)
        when (item.status) {
            "finish" -> {
                if (item.profit_num > 0) {
                    holder.setText(R.id.tvStatus, "中" + item.profit_num + "雷")
                } else {
                    holder.setText(R.id.tvStatus, "未中雷")
                }
                holder.setGone(R.id.tvStatusTwo, true)
                holder.setVisible(R.id.llCoinNum, true)
                if (item.profit_score.toDouble() > 0) {
                    holder.setTextColor(R.id.tvHaveCoin,Color.parseColor("#FF6325"))
                    holder.setText(R.id.tvHaveCoin, "+"+item.profit_score)
                } else {
                    holder.setTextColor(R.id.tvHaveCoin,Color.parseColor("#987C71"))
                    holder.setText(R.id.tvHaveCoin, item.profit_score)
                }
            }
            "wait" -> {
                holder.setGone(R.id.llCoinNum, true)
                holder.setVisible(R.id.tvStatusTwo, true)
                holder.setText(R.id.tvStatus, "进行中")
                holder.setText(R.id.tvStatusTwo, "等待奖励结算")
            }
        }
        val list = item.select_num
        var str = ""
        if (list.size == 1) {
            str = "雷号：" + list[0]
        } else if (list.size == 2) {
            str = "雷号：" + list[0] + "," + list[1]
        }
        holder.setText(R.id.tvSelectNums, str)
//        holder.setText(R.id.tvSelectNums,str)
    }
}